import React, { useState, useEffect, useRef } from 'react'
import '@/css/Home.css';
export default function (props) {
  const { stkCodeName ,handleThinkStk} = props;
  const [isShow, setIsShow] = useState(true)

  const handleItem = (stkName,stkCode) => { 
    handleThinkStk( stkName,stkCode)
    setIsShow(false)
  }
  useEffect(() => {
    setIsShow(true)
  }, [stkCodeName]);
  return (
    (stkCodeName && stkCodeName.length > 0 && isShow) ?
      ( 
    <ul className="box-think-wrap">
      {stkCodeName.map((v, k) => {
        return <li key={k} className="box-think-item" onClick={() => { handleItem(v.name,v.code)}}>{v.code+','+v.name}</li>
        })
      }
    </ul>
      )
      :null
  )
}